package org.example.chat.vo;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @author cheva
 */
@Data
public class RegisterVo {

    @NotBlank(message = "账号不能为空")
    @Length(min = 8, max = 11, message = "账号长度必须在8 ~ 11")
    @Pattern(message = "账号必须是数字", regexp = "\\d{8,11}")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Length(min = 8, max = 30, message = "密码长度在8 ~ 30")
    @Pattern(regexp = "((\\d+[a-zA-Z]+)|([a-zA-Z]+\\d+))+", message = "密码必须是数字和字母的组合")
    private String password;

    @NotEmpty(message = "昵称不能为空")
    @Length(max = 50, message = "昵称最长50个字符")
    private String nickname;

    @NotNull(message = "性别不能为空")
    private Integer sex;

    @NotEmpty(message = "邮箱不能为空")
    private String email;

    @NotEmpty(message = "地区不能为空")
    private String areaName;

    @NotEmpty(message = "验证码不能为空")
    private String capture;

    @NotEmpty(message = "验证码key不能为空")
    private String captchaKey;
}
